﻿using c2iGMailNotifier.ViewModel;

namespace c2iGMailNotifier
{
    public class Locator
    {

        private static EmailsListViewModel _emailsListViewModel;
        private static ToolbarViewModel _toolbarViewModel;
        private static OptionsViewModel _optionsViewModel;

        #region EmailsListViewModel properties
        public EmailsListViewModel EmailsListViewModel
        {
            get { return EmailsListViewModelStatic; }
        }

        public static EmailsListViewModel EmailsListViewModelStatic
        {
            get
            {
                if (_emailsListViewModel == null)
                    _emailsListViewModel = new EmailsListViewModel();

                return _emailsListViewModel;
            }
        }
        #endregion

        #region ToolbarViewModel properties

        public ToolbarViewModel ToolbarViewModel
        {
            get { return ToolbarViewModelStatic; }
        }

        public static ToolbarViewModel ToolbarViewModelStatic
        {
            get
            {
                if (_toolbarViewModel == null)
                    _toolbarViewModel = new ToolbarViewModel();

                return _toolbarViewModel;
            }
        }

        #endregion

        #region OptionsViewModel properties

        public OptionsViewModel OptionsViewModel
        {
            get { return OptionsViewModelStatic; }
        }

        // DataContext="{Binding Source={x:Static vm:Locator.OptionsViewModelStatic}}"
        public static OptionsViewModel OptionsViewModelStatic
        {
            get
            {
                if (_optionsViewModel == null)
                    _optionsViewModel = new OptionsViewModel();

                return _optionsViewModel;
            }
        }

        #endregion

    }
}